#include <src/pcps.h>
#include <src/timing.h>

namespace pcps {

  namespace timers {

    pthread_mutex_t mutex;

    pcps::Stopwatch overall_time;

  }

}

void pcps::initialize_timers() {
  pthread_mutex_init(&pcps::timers::mutex, NULL);
  pcps::timers::overall_time.reset();
}

void pcps::finalize_timers() {
  pthread_mutex_destroy(&pcps::timers::mutex);
}

void pcps::start_overall_timer(const int thread_id) { if (thread_id == 0) pcps::timers::overall_time.start(); }

void pcps::stop_overall_timer(const int thread_id) { if (thread_id == 0) pcps::timers::overall_time.stop(); }

const pcps::Stopwatch & pcps::get_overall_timer() { return pcps::timers::overall_time; }

